package com.wzbc.video.interceptor;

import com.alibaba.fastjson.JSON;
import com.wzbc.video.utils.TokenUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

@Slf4j
@WebFilter(filterName = "ReqFilter",urlPatterns = "/*")
public class ReqFilter implements Filter {
    @Autowired
    TokenUtil tokenUtil;

    public ReqFilter() {
        System.out.println("init reqFilter");
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
            throws IOException, ServletException {
        HttpServletRequest req = (HttpServletRequest) request;
        log.info("url={}", req.getRequestURI());
        chain.doFilter(req, response);
    }

    @Override
    public void destroy() {
    }
}